﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Axis.BusinessObject;
using Axis.Dao.Visitor;
using Axis.BusinessObject.Core;

namespace Sotipha.Web.Admin.Views.Visitor
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CVisitorDao visitor = new CVisitorDao();
                CVisitorSetting iten = visitor.GetVisitorSetting("<Input/>");
                txtOnline.Text = iten.Online.ToString();
                txtToday.Text = iten.Today.ToString();
                txtWeek.Text = iten.Week.ToString();
                txtTotal.Text = iten.Total.ToString();
            }

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            CVisitorDao visitor = new CVisitorDao();
            string Input = string.Format("<InputValue Online=\"{0}\" Today=\"{1}\" Week=\"{2}\" Total=\"{3}\"/>", txtOnline.Text, txtToday.Text, txtWeek.Text, txtTotal.Text);
            CApplicationMessage message = visitor.ActionVisitorSetting(Input);
             if (message.Code == "Ok") {
                 lblMessage.Text = "Ok";
             }
             else
                 lblMessage.Text = "Error";
        }
    }
}